<!DOCTYPE html>
<html>
<head>
    <title>js面向对象--继承(更简单的原型语法)</title>
    <meta charset="utf-8"/>
    <script>

        function Person(name, age, job){
            //属性
            this.name = name;
            this.age = age;
            this.job = job;

            //方法
            if(typeof this.sayName != "function"){
                Person.prototype.sayName = function(){
                    alert(this.name);
                }
            }
        }

       var per1 = new Person("Nike", 29, "Software");
       per1.sayName();
    </script>
</head>
<body>
</body>
</html>